package cn.hycat.leetcode.easy;

import java.util.List;

/**
 * @author 吕泽浩业
 * @version 1.0
 */
public class L剑指OfferII024反转链表 {
    class ListNode {
        int val;
        ListNode next;
        public ListNode(int val, ListNode listNode) {
            this.val = val;
            this.next = listNode;
        }
    }
    public ListNode reverseList(ListNode head) {
        ListNode cur = head;
        ListNode pre = null;
        while (cur != null) {
            ListNode next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }
        return pre;
    }
}